﻿using System;
using System.Collections;

namespace Twofolders
{
    public class ListViewItemComparer : IComparer
    {
        private int m_columnIndex;

        public ListViewItemComparer()
        {
            m_columnIndex = 0;
        }

        public ListViewItemComparer(int columnIndex)
        {
            m_columnIndex = columnIndex;
        }
        
        public int Compare(object x, object y)
        {
            return String.Compare((x as System.Windows.Forms.ListViewItem).SubItems[m_columnIndex].Text,
                (y as System.Windows.Forms.ListViewItem).SubItems[m_columnIndex].Text);
        }
    }
}
